<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div id="app">
    <span ref="dom">我就是一个dom</span>
  </div>
  <script src="./vue.js"></script>
  <script>
    const vm = new Vue({
      el: '#app',
      created () {
        console.log('组件初始化')
        console.log(this.$refs.dom)
        // created 中获取不到DOM
      },
      mounted () {
        console.log('模板渲染完毕')
        console.log(this.$refs.dom)
        // mounted 才可以获取dom
      }
    })
  </script>
</body>
</html>